<%@ page language="java" import="java.util.*, java.text.*,com.zjut.zs.util.tools.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*,
com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.zs.pay.manager.*, com.zjut.zs.pay.dao.*,com.zjut.wx.pay.order.*, java.net.URLEncoder,
com.zjut.zs.cj.manager.*, com.zjut.zs.cj.dao.*,com.zjut.zs.xy.manager.*, com.zjut.zs.xy.dao.*,
com.zjut.zs.zxlb.manager.*, com.zjut.zs.zxlb.dao.*,com.zjut.zs.shhd.manager.*, com.zjut.zs.shhd.dao.*,
com.zjut.zs.exvalue.manager.*, com.zjut.zs.exvalue.dao.*,com.zjut.zs.coname.manager.*, 
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.applyview.dao.*,com.zjut.zs.applyview.manager.*,com.zjut.an.config.manager.*,com.zjut.an.config.dao.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/web.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../plugins/assets/plugins/jquery-3.5.1.min.js"></script>
<script src="js/qrcode.js"></script>			
</head>

<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
	if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
	ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
	ZsPayManager pmanager = (ZsPayManager) SpringContextUtil.getBean("ZsPayManager");
	ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
	ZsUserStatusManager zsmanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");
	AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
	
	ZsSchool school = new ZsSchool();
	school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);
	ZsUser user = (ZsUser)session.getAttribute("zsUser");
	ZsUserStatus userstatus = zsmanager.getDataByUser(user);
%>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="index.jsp">首页</a></li>
    <li><a href="#">网上支付</a></li>
    </ul>
    </div>
    <div class="formbody">
    
	    <div class="rightinfo">
		    
			<div class="formtitle"><span>网上支付</span></div>
			<!--单页面-->  
			<div id="news1">
			        
			<br/>  
					<div class="news1content">
					<%
					if (!Status.ON.getStatus().equals(school.getScPayActive())) {
						out.println("尚未开放缴费功能。");
					} else if (!Status.CHECKSTATUS_YES.getStatus().equals(userstatus.getCheckStatus())) {
						out.println("尚未满足缴费条件");
					} else {						
						if (Status.PAYSTATUS_YES.getStatus().equals(userstatus.getPayStatus())) {
							out.println("你已经完成缴费");
						} else {
							ZsPay pay = pmanager.addData(user, Status.PAY_GGZF.getStatus());
							%>
							<div align="center" id="qrcode">
								<p >
								
								缴费状态：<%=userstatus.getPayStatus() %><br>
								金额：<%=anconfig.getSingleConfigInfoByName("缴费金额") %> 元<br>
								<a href="javascript:open_win()" class="btn btn-primary btn-sm">点击缴费</a>
								
								
								<br>
								</p>
							</div>
							 
							<%							
						}	
					}
					 %>
					 <div style="margin:0 auto;"><%out.print(anconfig.getSingleConfigInfoByName("缴费需知")); %></div>
					</div>
			</div>
	    </div>
    </div>
    
    <script>
    function open_win() {
        window.open("https://swyt.zjhzu.edu.cn/demo/hzxy/hzxyOrderCreate.do?usId=<%=user.getUsId() %>&usIdcard=<%=user.getUsIdcard() %>&usName=<%=user.getUsName() %>");
    }
    
	function getPayState(){
		$.ajax({
			url:'../zsApplyView.action?usId=<%=user.getUsId()%>',
			type:'post',
			cache:false,
			success:function(res){
				if(res.rows && res.rows.payStatus === '<%=Status.PAYSTATUS_YES.getStatus()%>'){
					clearInterval(i1)
					alert('你已成功缴费');
					top.window.location='main.jsp';
				}
			}
		})
	}
	var i1 = setInterval(getPayState,2000)
	</script>

<%} %>


</body>

</html>
